Cluster-Alias cleanup for VTOrc#11193
Conversation
…er name set to keyspace shard Signed-off-by: Manan Gupta <manan@planetscale.com>
…ur of a single cluster_name set to the keyspace/shard Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
| assert.False(t, primaryInstance.HasReplicationCredentials) | ||
| assert.Equal(t, primaryInstance.ReplicationIOThreadState, inst.ReplicationThreadStateNoThread) | ||
| assert.Equal(t, primaryInstance.ReplicationSQLThreadState, inst.ReplicationThreadStateNoThread) | ||
| assert.Equal(t, fmt.Sprintf("%v:%v", keyspace.Name, shard0.Name), primaryInstance.ClusterName) |
There was a problem hiding this comment.
This augments the existing ReadTopologyInstanceBufferable end to end test to also verify that we set the cluster_name correctly.
| log.Fatal(err) | ||
| } | ||
| fmt.Println(instanceKey.DisplayString()) | ||
| fmt.Println("Command deprecated") |
There was a problem hiding this comment.
I have removed some API and CLI commands that would have required some changes and that we don't intend to support anyways. I could have removed them as a separate PR, but I elected to do it here as I went along.
| condition := ` | ||
| cluster_name = ? | ||
| and (replication_depth = 0 or is_co_primary) | ||
| and tablet_type = ? |
There was a problem hiding this comment.
This additional step is required because earlier when we started a new tablet, it used to come up and its cluster_name would be set to the hostname:port of itself. But now, it will be set the keyspace/shard and then that new tablet used to show up in this ReadClusterPrimary function.
A better way is to also employ filtering on the tablet_type to be Primary.
Currently this function isn't unit tested, but it is end-to-end tested in GracefulPrimaryTakeover tests. I intend to add unit tests for all these functions that are reading data from the backend, but it will require some testing code setup, so I have deferred it to another PR.
|
Personally, I would have liked to go a step further and cleanup a few more things like make |
deepthi
left a comment
There was a problem hiding this comment.
LGTM.
Thank you for the inline comments. They made this much easier to review.
|
looks good to me! |
* test: augment readTopologyInstanceBufferable test to expect the cluster name set to keyspace shard Signed-off-by: Manan Gupta <manan@planetscale.com> * feat: remove cluster_alias and suggested_cluster_alias fields in favour of a single cluster_name set to the keyspace/shard Signed-off-by: Manan Gupta <manan@planetscale.com> * feat: add tablet_type as a check for reading primaries Signed-off-by: Manan Gupta <manan@planetscale.com> Signed-off-by: Manan Gupta <manan@planetscale.com> Signed-off-by: Manan Gupta <manan@planetscale.com>
Description
This PR addresses one of the long-standing cleanups required for VTOrc.
Orchestrator used to identify a cluster by the
host:portname of the primary, which was used as the cluster_name. In order to have a more human-readable variant, it also hadcluster_aliaswhich could be set by regex matching from configurations, etc. Manual overrides could also be performed for acluster_alias.In the first iteration of VTOrc, an additional parameter called
suggested_cluster_aliaswas added which was set tokeyspace/shard.Since VTOrc can just use this
keyspace/shardto identify a cluster, it is much simpler to just use this for cluster_name and get rid of the other two fields. This leads to other cleanups too, where we don't have to change the cluster_name in case of a reparent, etc.This PR makes this change, by cleaning up these two fields and setting cluster_name to
keyspace/shardRelated Issue(s)
Checklist
Deployment Notes